﻿using System;
using Gems;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace GemsTest
{
    [TestClass]
    public class BoolVectorTests
    {
        [TestMethod]
         public void StoredCorrectly()
         {
             for (int i = 0; i < 128; i++)
             {
                 var vector = new BoolVector(128);
                 
                 vector[i] = true;

                 for (int j = 0; j < 128; j++)
                 {
                     if (i==j) Assert.IsTrue(vector[j]);
                     else Assert.IsFalse(vector[j]);
                 }

                 vector[i] = false;

                 for (int j = 0; j < 128; j++)
                 {
                     Assert.IsFalse(vector[j]);
                 }
             }
         }

        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        [TestMethod]
        public void ArgumentOutOfRangeInGet()
        {
            var vector = new BoolVector(3);
            vector[4].ToString();
        }

        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        [TestMethod]
        public void ArgumentOutOfRangeInSet()
        {
            var vector = new BoolVector(3);
            vector[4]=true;
        }
    }

    

}